home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / System / Hello World Due < prev    next >
Encoding:
Text File  |  1999-03-04  |  1.2 KB  |  66 lines  |  [TEXT/ToyS]

  1. on run
  2.     tell application "Note Pad" to activate
  3.     
  4.     FileNew()
  5.     
  6.     input state {keys down:"Hello World!"}
  7.     pause for 5 with seconds timing
  8.     
  9.     SelectAll()
  10.     pause for 30 -- Just for the user to see what's happening
  11.     EditCut()
  12.     FileRmv()
  13.     FileQuit()
  14.     
  15.     -- Save as a clipping and tell Finder to open it
  16.     set v1 to vol name of (the volume info of volume index 1)
  17.     set myFile to v1 & ":Desktop Folder:Hello World!"
  18.     save clipping GetClip() in myFile
  19.     tell application "Finder"
  20.         activate
  21.         open (myFile as alias)
  22.         pause for 60
  23.     end tell
  24.     activate
  25.     collate myFile with the trasher
  26. end run
  27.  
  28.  
  29. on GetClip()
  30.     set cp to {}
  31.     set flavs to clip with content flavors
  32.     repeat with flav in flavs
  33.         set cp to cp & {clip flavor flav}
  34.     end repeat
  35.     return cp
  36. end GetClip
  37.  
  38.  
  39. on SelectAll()
  40.     -- Select all
  41.     input state {keys down:"A", command key down:true}
  42. end SelectAll
  43.  
  44.  
  45. on EditCut()
  46.     -- Select all
  47.     input state {keys down:"X", command key down:true}
  48. end EditCut
  49.  
  50.  
  51. on FileNew()
  52.     input state {keys down:"n", command key down:true}
  53. end FileNew
  54.  
  55.  
  56. on FileRmv()
  57.     input state {keys down:"d", command key down:true}
  58.     pause for 30
  59.     input state {keys down:ASCII character 3} -- Enter
  60. end FileRmv
  61.  
  62.  
  63. on FileQuit()
  64.     input state {keys down:"Q", command key down:true}
  65. end FileQuit
  66.